package com.string.practice;

public class Revolve {
    public static void main(String[] args) {
        String A = "abcde";
        String B = "deabe";
        for (int i = 0; i < A.length(); i++) {
            //旋转
            A = revolve(A);
            //判断
            if (A.equals(B)) {
                System.out.println("匹配成功");
                break;
            }
            if (i == A.length() - 1) {
                System.out.println("匹配失败");
            }
        }
    }

    public static String revolve(String a) {
        char c = a.charAt(0);
        a = a.substring(1) + c;
        return a;
    }
}
